package com.company.management.controller.reward;

import com.company.management.domain.reward.dto.PunishmentsQueryDTO;
import com.company.management.domain.reward.vo.PunishmentsQueryVO;
import com.company.management.domain.reward.dto.PunishmentsAddDTO;
import com.company.management.service.reward.PunishmentsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @description:惩罚
 * @author: wangbin
 * @time: 2025/3/1
 **/
@Api(tags = "奖惩模块",value = "职位 PunishmentsController")
@RestController
@RequestMapping("/api/punishments")
public class PunishmentsController {
    @Autowired
    private PunishmentsService punishmentsService;

    /**
     * @Description: 新增惩罚
     * @Author: wangbin
     * @Date: 2025/3/1 15:07
     * @param punishmentsAddDTO 新增惩罚参数对象
     * @return
     **/
    @ApiOperation("新建惩罚")
    @PostMapping("/createPunishments")
    public ResponseEntity<Boolean> add(@RequestBody PunishmentsAddDTO punishmentsAddDTO) {
        punishmentsService.add(punishmentsAddDTO);
        return new ResponseEntity<>(HttpStatus.OK);
    }

    /**
     * @Description: 查看惩罚列表
     * @Author: wangbin
     * @Date: 2025/3/1 15:10
     * @return
     **/
    @ApiOperation("根据用户ID获取惩罚列表")
    @PostMapping("/getPunishmentsList")
    public ResponseEntity<List<PunishmentsQueryVO>> getPunishmentsList(@RequestBody PunishmentsQueryDTO punishmentsQueryDTO) {
        return new ResponseEntity<>(punishmentsService.findByUserId(punishmentsQueryDTO), HttpStatus.OK);
    }
}
